import {Component} from 'react'
import './index.css'
export default class List extends Component{
    constructor(props){
        super(props)
    }
    todoCheck = (item,e)=>{
        this.props.todoCheck(item,e.target.checked)
    }
    render(){
        return (
            <div className="todo-main">
                {
                    this.props.todoList.map(item=>{
                        return <div key={item.id} className="todo-item">
                            <input type="checkbox" checked={item.check} onChange={(e)=>this.todoCheck(item,e)}/>
                            {item.name}
                        </div>
                    })
                }
            </div>
        )
    }
}